package com.liming.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.List;

/**
 * @author liming
 * @date 2025/3/21
 */
@Getter
@AllArgsConstructor
public enum SortTypeEnum {

    DEFAULT(0, "默认"),
    PRICE_DESC(1, "价格从高到低"),
    PRICE_ASC(2, "价格从低到高"),
    SALES_COUNT(3, "销售");

    private final Integer code;
    private final String desc;

    public static Boolean isPriceSortType(Integer code) {
        return List.of(DEFAULT.getCode(), PRICE_ASC.getCode(), PRICE_DESC.getCode()).contains(code);
    }

    public static Boolean isSalesSortType(Integer code) {
        return SALES_COUNT.getCode().equals(code);
    }
}
